<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审核页面</title>
    <link rel="stylesheet" href="./layui-v2.5.7/layui/css/layui.css">
</head>


<body>
<table id="table" class="layui-hide"></table>
<script src="./layui-v2.5.7/layui/layui.js"></script>
<script>

    var data = [{
        "id": "10001"
        , "username": "杜甫"
        , "userId": "xianxin@layui.com"
        , "grade": "男"

    }, {
        "id": "10002"
        , "username": "李白"
        , "userId": "xianxin@layui.com"
        , "grade": "男"
    }]
    layui.use('table', function() {
        var table = layui.table;

        //展示已知数据
        table.render({
            elem: '#table'
            , cols: [ [ //标题栏
                {field: 'id', title: 'ID', hide:true}
                , {field: 'username', title: '用户名'}
                , {field: 'userId', title: '用户ID'}
                , {field: 'grade', title: '用户等级'}
               ,{field:'',title: '操作',templet:function (res){
                   return '<a class="layui-btn layui-btn-sm" onclick="ty('+res.id+')">同意</a>'+
                       '<a class="layui-btn layui-btn-sm layui-btn-danger">不同意</a>'
                    }}
            ] ]
            , data: data
        })

    })

    function ty(id){

        layer.msg(id)
    }
</script>
</body>
</html>